package Grafica;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFileChooser;
import javax.swing.JLabel;
import javax.swing.SwingUtilities;
import javax.swing.WindowConstants;



/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
@SuppressWarnings("serial")
public class Menu extends javax.swing.JFrame {
	private GuiJuego juego;
	private JButton botonJugar;
	private JButton botonSalir;
	private JLabel fondo;


	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				Menu inst = new Menu();		
				inst.setLocationRelativeTo(null);
			}
		});
	}
	
	public Menu() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
			getContentPane().setLayout(null);
			setUndecorated(true);
			
			setVisible(true);
			this.setPreferredSize(new java.awt.Dimension(800, 600));
			
			{
				botonJugar = new JButton();
				getContentPane().add(botonJugar, "Center");
				botonJugar.setText("Jugar");
				botonJugar.setBounds(358, 221, 87, 27);
				botonJugar.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
					
						JFileChooser chooser = new JFileChooser("./Mapa");
					    
						int returnVal = chooser.showOpenDialog(getParent());
						
					    if(returnVal == 0) {
							juego = new GuiJuego(chooser.getSelectedFile().getAbsolutePath());
					    }
					    						
					}
				});
				
			}
			{
				botonSalir = new JButton();
				getContentPane().add(botonSalir);
				botonSalir.setText("Salir");
				botonSalir.setBounds(473, 221, 87, 25);
				botonSalir.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						System.exit(0);
					}
				});
			}
			{
				fondo = new JLabel();
				getContentPane().add(fondo);
				fondo.setBounds(0, 0, 667, 500);
				fondo.setIcon(new ImageIcon(getClass().getClassLoader().getResource("Recursos/Graficos/Escenario/inicio.png")));
				fondo.setPreferredSize(new java.awt.Dimension(667, 500));
			}
			pack();
			this.setSize(667, 500);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
